<!--利率曲线行情-->
<template>
   <div class="app-container">
      <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="创建时间">
          <el-date-picker
              v-model="dateRange"
              size="small"
              style="width: 240px"
              value-format="YYYY-MM-DD"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="利率曲线">
        <el-input
            v-model="queryParams.instrument"
            placeholder="利率曲线"
            clearable
            size="small"
            style="width: 240px"
            @keyup.enter="handleQuery"
        />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" size="small" @click="handleQuery"
                     v-hasPermi="['curve:ircurve:ircurvequota:list']"
          >搜索</el-button>
        </el-form-item>
      </el-form>
     <el-row :gutter="10" class="mb8">
         <el-col :span="1.5">
            <el-button
               type="warning"
               plain
               icon="Download"
               size="small"
               @click="handleExport"
               v-hasPermi="['marketdata:equity:shares:sharesInfo:export']"
            >当页导出</el-button>
         </el-col>
       <el-col :span="1.5">
         <el-button
             type="warning"
             plain
             icon="Download"
             size="small"
             @click="handleExportAll"
             v-hasPermi="['marketdata:equity:shares:sharesInfo:export']"
         >全量导出</el-button>
       </el-col>
         <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>

      <xTable ref="ircurvequotaRef" refId="ircurvequotaRef"  v-loading="loading" :data="quotaList" >
        <template #columList>
        <el-table-column label="序号" type="index"  width="50">
        </el-table-column>
         <el-table-column label="开始日期" align="center" prop="begDate" width="100"/>
        <el-table-column label="结束日期" align="center" prop="endDate" width="100" />
        <el-table-column label="期限" align="center" prop="ircTerm" width="100"/>
        <el-table-column label="利率(%)" align="right" width="100" prop="ircRate" :formatter="formartTablePercentP4" :show-overflow-tooltip="true">
        </el-table-column>
         <el-table-column label="利率曲线代码"  width="250" align="center" :show-overflow-tooltip="true"  prop="ircCode"  />
         <el-table-column label="利率曲线名称"   align="center" :show-overflow-tooltip="true" prop="ircName"> </el-table-column>
        </template>
      </xTable>
      <pagination
         v-show="total > 0"
         :total="total"
         v-model:page="queryParams.pageNum"
         v-model:limit="queryParams.pageSize"
         @pagination="getList"
      />
   </div>
</template>

<script setup name="ircurvequota">
import {getIrQuotaList } from "@/api/curve/ircurve/ircurvequota";
import xTable from "@/xquant/base/xTable";
const { proxy } = getCurrentInstance();
const { M_TYPE } = proxy.useDict("M_TYPE");
const { A_TYPE } = proxy.useDict("A_TYPE");
const { CURRENCY } = proxy.useDict("CURRENCY");

const quotaList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const dateRange = ref([proxy.getSysDate(),proxy.getSysDate()]);

const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 20,
    instrument: undefined
  }
});

const { queryParams } = toRefs(data);

/** 查询列表 */
function getList() {
  loading.value = true;
  getIrQuotaList(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
    quotaList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}


/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}



/** 导出按钮操作 */
function handleExport() {
  proxy.download("/marketdata/tirCurveController/exportQuote", {
    ...queryParams.value
  }, `利率行情信息${new Date().getTime()}.xlsx`);
}

/** 导出按钮操作 */
function handleExportAll() {
  proxy.download("/marketdata/tirCurveController/exportQuote", Object.assign({
    ...queryParams.value
  },{pageSize:''}), `利率行情信息${new Date().getTime()}.xlsx`);
}
getList();
</script>
